<%@ page language="java" contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="UTF-8">
	<title>用户中心</title>
	<script type="text/javascript" src="/static/js/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
</head>
<body>

<script type="text/javascript">
 	var baseUrl = "http://127.0.0.1:8080/phoenix-apps-cms";
 
 	var hostName = window.location.hostname;
	function showOneBannerPersist(id){
 		$.ajax({
 			url:baseUrl+"/cmsBanner/getOneBanner/"+id,
 			type:'GET',
 			success:function(v){
 				$("#show").text("IdxAdPic [id=" + v.id + ", picTitle=" + v.picTitle + ", picUrl="
 							+ v.picUrl + ", rbg=" + v.rbg + ", picHref=" + v.picHref
 							+ ", picWeight=" + v.picWeight + ", picAlt=" + v.picAlt
 							+ ", status=" + v.status + ", onlineTime=" + v.onlineTime
 							+ ", offlineTime=" + v.offlineTime + ", createTime=" + v.createTime
 							+ ", updateTime=" + v.updateTime + "]");
 				/* $.each(res.items,function(i,v){
 					$("#show").append("IdxAdPic [id=" + v.id + ", picTitle=" + v.picTitle + ", picUrl="
 							+ v.picUrl + ", rbg=" + v.rbg + ", picHref=" + v.picHref
 							+ ", picWeight=" + v.picWeight + ", picAlt=" + v.picAlt
 							+ ", status=" + v.status + ", onlineTime=" + v.onlineTime
 							+ ", offlineTime=" + v.offlineTime + ", createTime=" + v.createTime
 							+ ", updateTime=" + v.updateTime + "]<br/>")
 				})  */
 			}
 		})
 	}
	function showBannerPersist(){
 		$.ajax({
 			url:baseUrl+"/cmsBanner/getAllBannerByOrder",
 			type:'POST',
 			data:{pageSize:25,pageNo:1},
 			success:function(res){
 				//$("#show").text(res.items);
 				$.each(res.items,function(i,v){
 					$("#show").append("IdxAdPic [id=" + v.id + ", picTitle=" + v.picTitle + ", picUrl="
 							+ v.picUrl + ", rbg=" + v.rbg + ", picHref=" + v.picHref
 							+ ", picWeight=" + v.picWeight + ", picAlt=" + v.picAlt
 							+ ", status=" + v.status + ", onlineTime=" + v.onlineTime
 							+ ", offlineTime=" + v.offlineTime + ", createTime=" + v.createTime
 							+ ", updateTime=" + v.updateTime + "]<br/>")
 				}) 
 			}
 		})
 	}
	function insertBannerPersist(){
		var tbIdxAdPic = new Object;
		tbIdxAdPic.picTitle = "xxx";
		tbIdxAdPic.offlineTime="111111";
		tbIdxAdPic.onlineTime="111111";
		$.ajax({
 			url:baseUrl+"/cmsBanner/addOneBanner",
 			type:'POST',
 			data:{picTitle:"xxxx",offlineTime:new Date(111111111),onlineTime:new Date(111111111)},
 			//data:{picTitle:"xxxx",offlineTime:111111111,onlineTime:111111111},
 			//data:{tbIdxAdPic:tbIdxAdPic},
 			success:function(res){
 				$("#show").text("success");
 			},error:function(e1,e2){
 				$("#show").text(e2);
 				$("#show").append(e1.responseText);
 			}
 		})
 	}
	function updateBannerPersist(bannerId){
		$.ajax({
 			url:baseUrl+"/cmsBanner/updateOneBanner",
 			type:'POST',
 			//data:{id:bannerId,picTitle:"xxxx",offlineTime:new Date(111111111),onlineTime:new Date(111111111)},
 			data:{id:1, picTitle:'pic title', picUrl:'http://127.0.0.1:8080/static/demoimg/2.jpg', rbg:'#cfa972', picHref:'http://www.baidu.com', picWeight:1, picAlt:'pic中1' , status:0, onlineTime:new Date(1430190517), offlineTime:new Date(1430190517), createTime:new Date(1430188637), updateTime:new Date(1430190517)},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	function updateBannerStatusPersist(bannerId,status){
		$.ajax({
 			url:baseUrl+"/cmsBanner/updatePicBannerStatus",
 			type:'POST',
 			data:{rbannerId:bannerId,status:status},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	function updateBannerListStatusPersist(bannerIds,status){
		$.ajax({
 			url:baseUrl+"/cmsBanner/updatePicBannerStatusList",
 			type:'POST',
 			data:{list:bannerIds,status:status},
 			success:function(res){
 				$("#show").text(res.msg);
 			}
 		})
 	}
	
 </script>
<button onclick="showOneBannerPersist(1)">showOne测试</button><br>
<button onclick="showBannerPersist()">show测试</button><br>
<button onclick="insertBannerPersist()">insert测试</button><br>
<button onclick="updateBannerPersist(2)">updateBanner测试</button><br>
<button onclick="updateBannerStatusPersist(2,3)">updateStatus测试</button><br>
<button onclick="updateBannerListStatusPersist('2,3',1)">updateListStatus测试</button><br>
查询结果:<div id="show"></div>

</body>
</html>